<template>
    <div class="app-container">
        <el-form ref="form" :model="form" :rules="rules" label-width="80px">
            <!-- <el-form-item label="员工id" prop="employeeId">
                <el-input v-model="form.employeeId" placeholder="请输入员工id" />
            </el-form-item>
            <el-form-item label="房间id" prop="roomId">
                <el-input v-model="form.roomId" placeholder="请输入房间id" />
            </el-form-item> -->
            <el-form-item label="缴费日期" prop="feeDate">
    
                <el-input v-model="form.feeDate" placeholder="请输入缴费日期" />
            </el-form-item>
            <el-form-item label="缴费金额" prop="feeAmount">
                <el-input v-model="form.feeAmount" placeholder="请输入缴费金额" />
            </el-form-item>
            <el-form-item label="空调费" prop="airConditioningFee">
                <el-input v-model="form.airConditioningFee" placeholder="请输入空调费" />
            </el-form-item>
            <el-form-item label="级别" prop="level">
                <el-input v-model="form.level" placeholder="请输入级别" />
            </el-form-item>
            <el-form-item label="房租" prop="rent">
                <el-input v-model="form.rent" placeholder="请输入房租" />
            </el-form-item>
        </el-form>
        <div slot="footer" style="text-align:center">
            <el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>

        </div>

    </div>
</template>
  
<script>
import { listFee, getFee, addFee, updateFee } from "@/api/business/fee";

export default {
    name: "Fee",
    props: {
        rowData: {

        },
    },
    data() {
        return {
            // 按钮loading
            buttonLoading: false,
        
            form: {},
            // 表单校验
            // rules: {

            //     feeDate: [
            //         { required: true, message: "缴费日期不能为空", trigger: "blur" }
            //     ],
            //     feeAmount: [
            //         { required: true, message: "缴费金额不能为空", trigger: "blur" }
            //     ],
            //     airConditioningFee: [
            //         { required: true, message: "空调费不能为空", trigger: "blur" }
            //     ],
            //     level: [
            //         { required: true, message: "级别不能为空", trigger: "blur" }
            //     ],
            //     rent: [
            //         { required: true, message: "房租不能为空", trigger: "blur" }
            //     ]
            // }
        };
    },

    created() {
        //console.log(this.rowData)
        //this.getList();
        this.form.roomId = this.rowData.id;
        this.form.employeeId = this.rowData.employeeId;
    },
    methods: {
        // 表单重置
        reset() {
            this.form = {
                id: undefined,

                feeDate: undefined,
                feeAmount: undefined,
                airConditioningFee: undefined,
                level: undefined,
                rent: undefined
            };
            this.resetForm("form");
        },
        /** 提交按钮 */
        submitForm() {
            this.$refs["form"].validate(valid => {
                if (valid) {
                    this.buttonLoading = true;
                    addFee(this.form).then(response => {
                        this.$modal.msgSuccess("编辑成功");
                    }).finally(() => {
                        this.buttonLoading = false;
                    });
                }
            });
        },

    }
};
</script>
  